package com.chance.cc.crawler.development.command.trigger.domain.autohome;

import com.chance.cc.crawler.core.downloader.HttpPage;
import com.chance.cc.crawler.development.command.job.domain.autohome.AutoHomeWebArticleTraceCrawlerScheduleJob;
import com.chance.cc.crawler.development.command.trigger.CrawlerJobTriggerCommand;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;

/**
 * @author lt
 * @version 1.0
 * @date 2020-12-09 16:15:28
 * @email okprog@sina.com
 */
public class AutoHomeWebScheduleTrigger {
    private static final String domain = "autohome";

    private static final CrawlerJobTriggerCommand crawlerJobTriggerCommand =
            new CrawlerJobTriggerCommand("192.168.1.215",9599);

    public static void main(String[] args) {
        String crawlerKey = AutoHomeWebArticleTraceCrawlerScheduleJob.autoHomeScheduler(domain).generateCrawlerKey();
        String crawlerTriggerKey = AutoHomeWebArticleTraceCrawlerScheduleJob.autoHomeScheduler(domain).generateCrawlerTriggerKey();
        publishAutoHomeArticleTraceCrawlerScheduleTriggerInfo(crawlerKey,crawlerTriggerKey);
    }

    /**
     * 发布汽车之家新闻trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeArticleCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/1 * * ?",
                "汽车之家新闻实时采集任务执行，每小时执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }
    /**
     * 发布汽车之家新闻回溯trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeArticleTraceCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "汽车之家新闻回溯三天采集任务执行，每天执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }



    /**
     * 发布汽车之家视频trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeVideoCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/1 * * ?",
                "汽车之家视频实时采集任务执行，每小时执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家视频回溯trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeVideoTraceCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "汽车之家视频回溯三天回复采集任务执行，每天执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }




    /**
     * 发布汽车之家论坛最新回复trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeForumReplyCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "汽车之家论坛最新回复实时采集任务执行，每天1点执行一次"
        );

        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }


    /**
     * 发布汽车之家论坛追溯三天互动trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeForumInteractionCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "汽车之家论坛追溯三天互动采集任务执行，每天3点执行一次"
        );

        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家论坛最新发布trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeForumReleaseCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/1 * * ?",
                "汽车之家论坛最新发布实时采集任务执行，每1小时执行一次"
        );

        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家口碑实时trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomePraiseCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/1 * * ?",
                "汽车之家口碑实时采集任务执行，每1小时执行一次"
        );

        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家口碑回溯trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomePraiseTraceCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "汽车之家口碑回溯三天回复采集任务执行，每天执行一次"
        );

        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }


    /**
     * 发布汽车之家车家号文章实时trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeCheArticleCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/1 * * ?",
                "汽车之家车家号文章实时采集任务执行，每小时执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家车架号文章回溯三天回复trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeCheArticleTraceCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "汽车之家车家号文章回溯三天回复采集任务执行，每天执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家车家号视频实时trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeCheVideoCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/1 * * ?",
                "汽车之家车家号视频实时采集任务执行，每小时执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家车架号视频回溯三天回复trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeCheVideoTraceCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "汽车之家车家号视频回溯三天回复采集任务执行，每天执行一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    /**
     * 发布汽车之家测试发布trigger info
     * @param crawlerKey
     * @param crawlerTriggerKey
     */
    public static void publishAutoHomeTestCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey){
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Simple,
                "",
                "汽车之家测试"
        );

        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }
}
